package request

import (
	common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
	//"github.com/go-playground/validator/v10"
)

// WxOneTapRegister 微信一键注册登录请求参数
type WxOneTapRegister struct {
	LoginCode string `json:"loginCode" binding:"required" validate:"required"` // 前端登入凭证码
	PhoneCode string `json:"phoneCode"`                                        // 前端登入凭证码
}

// Register User register structure
type Register struct {
	Username  string `json:"userName" example:"用户名"`
	Password  string `json:"passWord" example:"密码"`
	NickName  string `json:"nickName" example:"昵称"`
	HeaderImg string `json:"headerImg" example:"头像链接"`
	Phone     string `json:"phone" example:"电话号码"`
	Email     string `json:"email" example:"电子邮箱"`
	Grade     int    `json:"grade" example:"年级"`
	School    int    `json:"school" example:"学校"`
	Major     int    `json:"major" example:"专业"`
	Education int    `json:"education" example:"学历"`
	Signature string `json:"signature" example:"个性签名"`
	Gender    int    `json:"gender" example:"性别"`
	Age       int    `json:"age" example:"年龄"`
}

type AdminRegister struct {
	Username     string `json:"userName" example:"用户名"`
	Password     string `json:"passWord" example:"密码"`
	NickName     string `json:"nickName" example:"昵称"`
	HeaderImg    string `json:"headerImg" example:"头像链接"`
	AuthorityId  uint   `json:"authorityId" swaggertype:"string" example:"int 角色id"`
	Enable       int    `json:"enable" swaggertype:"string" example:"int 是否启用"`
	AuthorityIds []uint `json:"authorityIds" swaggertype:"string" example:"[]uint 角色id"`
	Phone        string `json:"phone" example:"电话号码"`
	Email        string `json:"email" example:"电子邮箱"`
	Grade        int    `json:"grade" example:"年级"`
	School       int    `json:"school" example:"学校"`
	Major        int    `json:"major" example:"专业"`
	Education    int    `json:"education" example:"学历"`
	Signature    string `json:"signature" example:"个性签名"`
	Gender       int    `json:"gender" example:"性别"`
	Age          int    `json:"age" example:"年龄"`
}

// Login User login structure
type Login struct {
	Username  string `json:"username"`  // 用户名
	Password  string `json:"password"`  // 密码
	Captcha   string `json:"captcha"`   // 验证码
	CaptchaId string `json:"captchaId"` // 验证码ID
}
type CLogin struct {
	Phone    string `json:"phone"`    // 用户名
	Password string `json:"password"` // 密码
}

// ChangePasswordReq Modify password structure
type ChangePasswordReq struct {
	ID          uint   `json:"-"`           // 从 JWT 中提取 user id，避免越权
	Password    string `json:"password"`    // 密码
	NewPassword string `json:"newPassword"` // 新密码
}

type ResetPassword struct {
	ID       uint   `json:"ID" form:"ID"`
	Password string `json:"password" form:"password" gorm:"comment:用户登录密码"` // 用户登录密码
}

// SetUserAuth Modify user's auth structure
type SetUserAuth struct {
	AuthorityId uint `json:"authorityId"` // 角色ID
}

// SetUserAuthorities Modify user's auth structure
type SetUserAuthorities struct {
	ID           uint
	AuthorityIds []uint `json:"authorityIds"` // 角色ID
}

type ChangeUserInfo struct {
	ID        uint   `gorm:"primarykey"`                                                                           // 主键ID
	NickName  string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                            // 用户昵称
	Phone     string `json:"phone"  gorm:"comment:用户手机号"`                                                          // 用户手机号
	Email     string `json:"email"  gorm:"comment:用户邮箱"`                                                           // 用户邮箱
	HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
	Grade     int    `json:"grade" gorm:"comment:年级"`                                                              // 年级
	School    int    `json:"school" gorm:"comment:学校"`                                                             // 学校
	Education int    `json:"education" gorm:"comment:学历"`                                                          // 学历
	Signature string `json:"signature" gorm:"comment:个性签名"`                                                        // 个性签名
}

type GetUserList struct {
	common.PageInfo
	UserIds   []string `json:"userIds" form:"userIds"` // 根据用户ids列表获取
	Username  string   `json:"username" form:"username"`
	NickName  string   `json:"nickName" form:"nickName"`
	Phone     string   `json:"phone" form:"phone"`
	Email     string   `json:"email" form:"email"`
	Grade     int      `json:"grade" form:"grade"`
	School    int      `json:"school" form:"school"`
	Major     int      `json:"major" form:"major"`
	Education int      `json:"education" form:"education"`
}

// GetUserIMTokenReq 请求获取用户
type GetUserIMTokenReq struct {
	ID         uint `gorm:"primarykey" json:"id"` // 主键ID
	PlatformID int  `json:"platform_id"`          // 平台id
}

// MajorAuthRequest 专业认证请求参数
type MajorAuthRequest struct {
	UserID  uint `json:"userId" binding:"required" validate:"required"`       // 用户ID
	MajorID int  `json:"majorId" binding:"required" validate:"required,gt=0"` // 专业ID
}
